﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace FigureDraw.Graphic
{
    public class GDIPlusScreenGraphic : CommonGraphic
    {
        System.Drawing.Graphics g;
        Pen p;

        public GDIPlusScreenGraphic(Graphics g)
        {
            this.g = g;
            this.p = new Pen(Color.Black);
        }

        override public void DrawLine(double x1, double y1, double x2, double y2)
        {
            g.DrawLine(p, (float)x1, (float)y1, (float)x2, (float)y2);
        }

        override public void DrawRectangle(double x, double y, double width, double height)
        {
            g.DrawRectangle(p, (float)x, (float)y, (float)width, (float)height);
        }

        override public void DrawEllipse(double x, double y, double width, double height)
        {
            g.DrawEllipse(p, (float)x, (float)y, (float)width, (float)height);
        }


        override public void DrawPicture(List<MyShape> shapes)
        {
            base.DrawPicture(shapes);
        }

        public override void DrawText(string text, double size, double x, double y)
        {       
            g.DrawString(text, new Font(new FontFamily("Tahoma"), (float)size), new SolidBrush(Color.Black), (float)x, (float)y);
        }

        public override void DrawArc(double x, double y, double width, double height, double startAngle, double sweepAngle)
        {
            AdjustableArrowCap bigArrow = new AdjustableArrowCap(5, 5);
            Pen p = new Pen(Color.Black, 1);
            p.CustomEndCap = bigArrow;

            g.DrawArc(p, (float)x, (float)y, (float)width, (float)(2 * height), (float)startAngle, (float)sweepAngle);
        }
    }
}
